package com.qfjy.homework.WanChuanDong;

/**
 * @author:宛传冬
 * @date:2022/11/10 19:15
 * @version：1.0
 */
public class Proxy implements Subject {

    //要代理的实现类
    private  Subject subject = null;

    //默认代理自己
    public Proxy(){
        this.subject = new Proxy();
    }

    public Proxy(Subject subject) {
        this.subject = subject;
    }

    //构造函数，传递委托者
    //Object委托者
    private  Proxy(Object... objects){

    }


    @Override
    public void request() {
        this.before();
        this.subject.request();
        this.after();
    }


    //预处理
    private void before() {
        System.out.println("访问之前处理");
    }


    //后处理
    private void after() {
        System.out.println("访问之后处理");
    }

}
